﻿using HZH_Controls.Forms;
using Petroleum.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Petroleum.UC.Public
{
    public partial class FormChoice : FrmBack
    {
        public FormChoice()
        {
            InitializeComponent();
            FrmTitle = "返回首页";
            BtnBackClick += BtnBackClick_BtnClick;
        }
        private void BtnBackClick_BtnClick(object sender, EventArgs e) 
        {
            if (txtWellName.InputText == string.Empty) 
            {
                FrmTips.ShowTipsWarning(this, "请先补全项目名称");
                return;
            }
            if (labTemplate.Text.Equals("暂未选择模板，请先选择模板"))
            {
                FrmTips.ShowTipsWarning(this, "请先选择模板文件");
                return;
            }
            Session.TemplateFile = labTemplate.Text;
            Session.WellName = txtWellName.InputText;
            this.Close();
        }
        private void btnDown_BtnClick(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Multiselect = true;
            fileDialog.Title = "请选择文件";
            fileDialog.Filter = "所有文件(*docx*)|*.doc*"; //设置要选择的文件的类型
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                string file = fileDialog.FileName;//返回文件的完整路径         
                labTemplate.Text = file;
                Session.TemplateFile = file;
                FrmTips.ShowTipsSuccess(this, "模板文件选择成功！");
            }
        }
    }
}
